
using System;
using System.Text ;
using System.Data ;
using System.Collections ;

using WP.MF.BusinessRule; 
using WP.MF.DataEntity; 
using WP.MF.DataAccess; 
using WP.Commons;
using WP.DB;

namespace WP.MF.BusinessLogical
{
	/// <summary>
	/// Summary description for MUserBranchBLL.
	/// </summary>
	public class MUserBranchBLL
	{
		MUserBranchDAL MUserBranchDAL = new MUserBranchDAL();
		public MUserBranchBLL()
		{
		}

		#region Get User Access info
		public MUserBranchDEL SelectUserAccess(string strBranchNo)
		{
			DBAccess dBAccess=new DBAccess(false,false);

			try
			{
				//Get MUserBranch Info
				MUserBranchDEL MUserBranchDEL=MUserBranchDAL.SelectUserAccess(dBAccess,strBranchNo);

				return MUserBranchDEL;
			}
			catch(Exception e)
			{
				ExceptionManager.ProcessException(e);
				return null;
			}
			finally
			{
				dBAccess.CloseCon();
			}
		}
		#endregion Get User Access info

		#region  Update User Access
		public bool UpdateUserAccess(string strBranchNo,MUserBranchDEL mUserBranchDEL)
		{
			DBAccess dBAccess=new DBAccess(false,true);
			try
			{
				MUserBranchDAL mUserBranchDAL=new  MUserBranchDAL();
				mUserBranchDAL.DeleteUserAccess(dBAccess,strBranchNo);
				mUserBranchDAL.InsertUserAccess(dBAccess,mUserBranchDEL);
				dBAccess.CommitTranAndCloseCon();
				return true;
			}
			catch(Exception e)
			{
				//RollBackTran trainsaction
				dBAccess.RollbackTran();
				throw new Exception (e.Message);
			}
		}		
		#endregion Update User Access

	}
}



